<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2985：[Balkan2009]year2012</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Balkan2009]year2012</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Balkan2009]year2012</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Balkan2009]year2012                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div><span style="font-size: 22pt">&nbsp;</span><span style="font-size: 14pt">传说</span><span style="font-size: 14pt">2012-12-21</span><span style="font-size: 14pt">是世界末日啊！（虽然今天已经是</span><span style="font-size: 14pt">2012-12-26</span><span style="font-size: 14pt">了&hellip;&hellip;）人们都要逃亡了。到处都是自然灾害，导致地球上只有</span><span style="font-size: 14pt">n</span><span style="font-size: 14pt">个地方可以存活了。其中，我们在</span><span style="font-size: 14pt">s</span><span style="font-size: 14pt">号点，喜马拉雅山在</span><span style="font-size: 14pt">t</span><span style="font-size: 14pt">号点。对于这</span><span style="font-size: 14pt">n</span><span style="font-size: 14pt">个点，我们会用</span><span style="font-size: 14pt">(X<sub>i, </sub>Y<sub>i, </sub>Z<sub>i</sub>)</span><span style="font-size: 14pt">来描述这些点，而坐标原点则是地球中心。显然，这</span><span style="font-size: 14pt">n</span><span style="font-size: 14pt">个地点是不会靠在一起的，那么我们必须要用飞机来飞行。已知我们所坐的飞机会保持一个恒定的速度</span><span style="font-size: 14pt">v</span><span style="font-size: 14pt">，并有一个容量为</span><span style="font-size: 14pt">c</span><span style="font-size: 14pt">的油箱。刚出发时，油箱是满的。而这</span><span style="font-size: 14pt">n</span><span style="font-size: 14pt">个点之中，不是能够两两之间互相飞行的。可以飞的航线只有</span><span style="font-size: 14pt">m</span><span style="font-size: 14pt">条，而每一条所需的油量都不一样（双向航线）。更糟糕的是，不是所有的点都能加油，那么就意味着飞行员每到一个地点，就不得不把油加满！已知两点之间的距离为坐标之间的球面距离（因为是在地球上嘛），而飞行总时间为</span><span style="font-size: 14pt">(</span><span style="font-size: 14pt">总距离</span><span style="font-size: 14pt">/v)</span><span style="font-size: 14pt">，那么我们要从</span><span style="font-size: 14pt">s</span><span style="font-size: 14pt">号点飞到</span><span style="font-size: 14pt">t</span><span style="font-size: 14pt">号点至少需要多少时间呢？答案保留</span><span style="font-size: 14pt">10</span><span style="font-size: 14pt">位小数。</span></div>
<div><span style="font-size: 22pt">【数据范围及保证】</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">2&lt;=n&lt;=1000</span><span style="font-size: 14pt">，整数，表示地点的数量。</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">1&lt;=m&lt;=10000</span><span style="font-size: 14pt">，整数，表示可互相飞的航线数量。</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">1&lt;=v&lt;=1000</span><span style="font-size: 14pt">，实数，精度最高为</span><span style="font-size: 14pt">1e-3</span><span style="font-size: 14pt">，表示飞机的恒定速度。</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">1&lt;=c&lt;=1000</span><span style="font-size: 14pt">，整数，表示飞机油箱容量。</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">-100&lt;= X<sub>i, </sub>Y<sub>i, </sub>Z<sub>i</sub>&lt;=100</span><span style="font-size: 14pt">，实数，精度最高为</span><span style="font-size: 14pt">1e-18</span><span style="font-size: 14pt">，表示第</span><span style="font-size: 14pt">i</span><span style="font-size: 14pt">个点的坐标，其中数据保证</span><span style="font-size: 14pt">X<sub>i</sub><sup>2</sup>+Y<sub>i</sub><sup>2</sup>+Z<sub>i</sub><sup>2</sup></span><span style="font-size: 14pt">（即地球半径）为一个恒定的正整数（尽管存在精度差，但是</span><span style="font-size: 14pt">|</span><span style="font-size: 14pt">精度差</span><span style="font-size: 14pt">|&lt;=1e-10</span><span style="font-size: 14pt">，因此可认为每个点都严格在地球表面）。并保证，任意航线的长度</span><span style="font-size: 14pt">&gt;=1e-6.</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">1&lt;=</span><span style="font-size: 14pt">可加油的站点数量</span><span style="font-size: 14pt">&lt;=20</span></div>
<div style="text-indent: 21.75pt"><span style="font-size: 14pt">1&lt;=</span><span style="font-size: 14pt">地点的编号</span><span style="font-size: 14pt">&lt;=n;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&lt;=</span><span style="font-size: 14pt">航线所需油量</span><span style="font-size: 14pt">&lt;=c</span></div>
<div><span style="font-size: 22pt">【注意事项】</span></div>
<div style="margin: 0cm 0cm 0pt 39.75pt; text-indent: -18pt"><span style="font-size: 14pt">1.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 14pt">两点之间的距离为最短球面距离，可能有不止一条，但是只有一条有用。</span></div>
<div style="margin: 0cm 0cm 0pt 39.75pt; text-indent: -18pt"><span style="font-size: 14pt">2.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 14pt">a, b</span><span style="font-size: 14pt">之间的航线可能中途经过</span><span style="font-size: 14pt">c</span><span style="font-size: 14pt">点，但这不代表</span><span style="font-size: 14pt">a</span><span style="font-size: 14pt">和</span><span style="font-size: 14pt">c</span><span style="font-size: 14pt">之间或</span><span style="font-size: 14pt">b</span><span style="font-size: 14pt">和</span><span style="font-size: 14pt">c</span><span style="font-size: 14pt">之间有航线。</span></div>
<div style="margin: 0cm 0cm 0pt 39.75pt; text-indent: -18pt"><span style="font-size: 14pt">3.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 14pt">起飞，降落，加油等时间都可无视。</span></div>
<div style="margin: 0cm 0cm 0pt 39.75pt; text-indent: -18pt"><span style="font-size: 14pt">4.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 14pt">若无解，则输出</span><span style="font-size: 14pt">0.</span></div>
<div style="margin: 0cm 0cm 0pt 39.75pt; text-indent: -18pt"><span style="font-size: 14pt">5.<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 14pt">若</span><span style="font-size: 14pt">|</span><span style="font-size: 14pt">你输出的答案</span><span style="font-size: 14pt">-</span><span style="font-size: 14pt">标准答案</span><span style="font-size: 14pt">|&lt;=1e-4</span><span style="font-size: 14pt">，则算正确。</span></div></p><hr/><h3>输入格式</h3><p><div style="text-indent: 21pt"><span style="font-size: 14pt">第</span><span style="font-size: 14pt">1</span><span style="font-size: 14pt">行四个正数</span><span style="font-size: 14pt">n, m, v, c</span></div>
<div><span style="font-size: 14pt">&nbsp;&nbsp; </span><span style="font-size: 14pt">接下来</span><span style="font-size: 14pt">n</span><span style="font-size: 14pt">行，每行四个数，</span><span style="font-size: 14pt">X<sub>i</sub>, Y<sub>i</sub>, Z<sub>i</sub>, R<sub>i</sub></span><span style="font-size: 14pt">，其中</span><span style="font-size: 14pt">R<sub>i</sub>=1</span><span style="font-size: 14pt">表示该点可加油，</span><span style="font-size: 14pt">R<sub>i</sub>=0</span><span style="font-size: 14pt">表示该点不可加油。</span></div>
<div><span style="font-size: 14pt">&nbsp;&nbsp; </span><span style="font-size: 14pt">接下来</span><span style="font-size: 14pt">m</span><span style="font-size: 14pt">行，每行</span><span style="font-size: 14pt">3</span><span style="font-size: 14pt">个正整数，</span><span style="font-size: 14pt">A<sub>k</sub>, B<sub>k</sub>, C<sub>k</sub></span><span style="font-size: 14pt">，其中</span><span style="font-size: 14pt">A<sub>k</sub>, B<sub>k</sub></span><span style="font-size: 14pt">表示第</span><span style="font-size: 14pt">k</span><span style="font-size: 14pt">条航线所连接的两个站点。</span><span style="font-size: 14pt">C<sub>k</sub></span><span style="font-size: 14pt">表示该航线所需油量。</span></div>
<div><span style="font-size: 14pt">&nbsp;&nbsp; </span><span style="font-size: 14pt">最后</span><span style="font-size: 14pt">1</span><span style="font-size: 14pt">行，两个正整数，</span><span style="font-size: 14pt">s</span><span style="font-size: 14pt">和</span><span style="font-size: 14pt">t</span><span style="font-size: 14pt">。</span></div></p><hr/><h3>输出格式</h3><p><div><span style="font-size: 14pt">&nbsp;&nbsp; </span><span style="font-size: 14pt">仅一行，为所需最短时间。若无法到达</span><span style="font-size: 14pt">t</span><span style="font-size: 14pt">号点，则输出</span><span style="font-size: 14pt">0.</span></div></p><hr/><h3>样例输入</h3><pre>
6 9 2.5 9
0.0 5.0 0.0 1
0.0 0.0 -5.0 0
0.0 -5.0 0.0 0
0.0 0.0 5.0 0
3.0 4.0 0.0 0
4.0 3.0 0.0 1
1 2 5
2 3 8
1 4 5
4 3 5
1 5 1
5 6 9
5 2 1
2 6 2
6 4 4
1 3
</pre><hr/><h3>样例输出</h3><pre>
12.5663706144</pre><hr/><h3>提示</h3><p><p><img height="417" width="551" alt="" src="../file/2985_0.jpg" /></p>
<p></p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2985" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2985" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>